package com.study.juc;

import java.util.concurrent.locks.ReentrantLock;

public class ReentrantLockWait {
    private static ReentrantLock lock = new ReentrantLock();

    public static void main(String[] args) throws InterruptedException {
        new Thread(() -> {
            lock.lock();
            try{
                System.out.println(" = come in "+Thread.currentThread().getName());
                lock.lock();
                try{
                    System.out.println(" = come in "+Thread.currentThread().getName());
                }finally {
                    lock.unlock();
                }
            }finally {
                //lock.unlock();
            }
        }, "aaaa").start();
        new Thread(() -> {
            lock.lock();
            try{
                System.out.println(" = come in "+Thread.currentThread().getName());
            }finally {
                lock.unlock();
            }
        }, "bbbb").start();
        Thread.sleep(3000);
    }
}
